﻿using ETA.IService;
using Ninject;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ETA.UnitTest
{
    [TestFixture]
    public class ProjectTypeServiceTest
    {
        private static IProjectTypeService _IProjectTypeService { set; get; }
        private static IWorkTypeService _IWorkTypeService { set; get; }
        [SetUp]
        public void Init()
        {
            IKernel kernel = new StandardKernel(new NinjectModuleBuild());
            _IProjectTypeService = kernel.Get<IProjectTypeService>();
            _IWorkTypeService = kernel.Get<IWorkTypeService>();
        }


        [Test]
        public void QueryWorkTypeTest()
        {
            var req = new QueryWorkTypeRequest
            {

            };
            var rep = _IWorkTypeService.QueryWorkTypeList(req);
            var item = rep.WorkTypeList.FirstOrDefault();
          
            Assert.True(rep.Result.IsSuccess);
        }
        [Test]
        public void CreateProjectTypeTest()
        {
            var req = new QueryWorkTypeRequest
            {
                WorkTypeId = "58d578ad-06b1-4440-b9fd-c6f1b1e0edaf"
            };
            var rep = _IWorkTypeService.QueryWorkTypeList(req);
            //if (rep.Result.IsSuccess && rep.WorkTypeList.Any())
            //{
            //    var workType = rep.WorkTypeList.FirstOrDefault();
            //    var createProjectTypeReq = new CreateProjectTypeRequest
            //    {
            //        ProjectType = new Entity.ProjectType
            //        {
            //            ProjectTypeId = Guid.NewGuid() + "",
            //            WorkType = workType,
            //            ProjectTypeName = "车床",
            //            ProjectTypeDes = "车床描述"
            //        }
            //    };
            //    var reponse = _IProjectTypeService.CreateProjectType(createProjectTypeReq);
            //    Assert.True(reponse.Result.IsSuccess);
            //}
        }
    }
}
